package com.twu.biblioteca;


import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;


public class BookInventory {

    List<Book> books = new LinkedList<Book>();

    public BookInventory() {
        books.add(new Book(1, "O'Reilly", "Introduction To Java", "Mavin", "2003", "3rd Edition"));
        books.add(new Book(2, "Martin Fowler", "Introduction To Agile", "Thoughtworks", "2004", "1st Edition"));
        books.add(new Book(3, "O'Reilly", "Introduction To Java", "Mavin", "2010", "4rd Edition"));
        books.add(new Book(4, "O'Reilly", "Introduction To Java", "Mavin", "2012", "5rd Edition"));

    }

    public boolean isBookAvailable(int bookID) {

        for (Iterator i = books.iterator(); i.hasNext(); ) {
            Book book = (Book) i.next();
            if (book.getBookID() == bookID) {
                return true;
            }
        }
        return false;
    }

}
